﻿Namespace DoFactory.GangOfFour.Template.RealWorld2

    Public Class Program
        Public Shared Sub Main()

            Dim c As CarBuilder = New PorcheBuilder()
            c.BuildCar()

            c = New BeetleBuilder()
            c.BuildCar()
        End Sub
    End Class

    Public MustInherit Class CarBuilder
        Protected MustOverride Sub BuildSkeleton()
        Protected MustOverride Sub InstallEngine()
        Protected MustOverride Sub InstallDoor()

        'Template Method that specifies the general logic
        Public Sub BuildCar()
            BuildSkeleton()
            InstallEngine()
            InstallDoor()
        End Sub
    End Class

    Public Class PorcheBuilder
        Inherits CarBuilder
        Protected Overrides Sub BuildSkeleton()
            Console.WriteLine("Building Porche Skeleton")
        End Sub

        Protected Overrides Sub InstallEngine()
            Console.WriteLine("Installing Porche Engine")
        End Sub

        Protected Overrides Sub InstallDoor()
            Console.WriteLine("Installing Porche Door")
        End Sub
    End Class

    Public Class BeetleBuilder
        Inherits CarBuilder
        Protected Overrides Sub BuildSkeleton()
            Console.WriteLine("Building Beetle Skeleton")
        End Sub

        Protected Overrides Sub InstallEngine()
            Console.WriteLine("Installing Beetle Engine")
        End Sub

        Protected Overrides Sub InstallDoor()
            Console.WriteLine("Installing Beetle Door")
        End Sub
    End Class

End Namespace